#include "currencymgr.h"
#include "DbPart.h"
#include "minutelisten.h"



CurrencyMgr::CurrencyMgr()
{
}
CurrencyMgr::~CurrencyMgr()
{
}

stCurrency* CurrencyMgr::Get(const std::string& currency)
{
    auto it = m_mgr.find(currency);
    if (it != m_mgr.end())
    {   
        return &it->second;
    }

    // 加载数据库数据
    stCurrency st_currency;
    st_currency.currency = currency;
    if (!CDbPart::Instance()->GetCurrency(st_currency))
    {
        return nullptr;
    }
    // 配置值错误
    if (st_currency.unit_multi <= 0)
    {
        return nullptr;
    }
    m_mgr[currency] = st_currency;

    return &m_mgr[currency];
}







